package lab03.Test08;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * Created by lady on 2017/12/13.
 */
public class Test {
    public static void main(String[] args) {
        String file1="F:\\大二上学期\\Java\\实验读写文件\\test1.txt";
        String file2="F:\\大二上学期\\Java\\实验读写文件\\test2.tx";
        String file3="F:\\大二上学期\\Java\\实验读写文件\\test3.tx";
        //字节流读文件
        FileInputStream file1InputStream = null;
        FileInputStream file2InputStream = null;
        //字节流写文件
        FileOutputStream file3OutputStream=null;
        try {
            file1InputStream=new FileInputStream(file1);
            file2InputStream=new FileInputStream(file1);
            int data1;
            boolean data2;

            while(((data1=file1InputStream.read())!=-1)
                    || (data2=file2InputStream.read()!=-1)
                    ){
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally{
            try {
                file1InputStream.close();
                file2InputStream.close();
                file3OutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }

        }
    }

}
